class Gloves {
public:
    int findMinimum(int n, vector<int> left, vector<int> right) {
        int left_min=INT_MAX,right_min=INT_MAX;
        int left_sum=0,right_sum=0;
        int count=0;
        for(int i=0;i<n;i++)
        {
            //有一边为0的
            if(left[i]*right[i]==0)
            {
                count+=left[i]+right[i];
            }
            //sum-min+1
            else {
                left_min=left_min<left[i]?left_min:left[i];
                left_sum+=left[i];
                right_min=right_min<right[i]?right_min:right[i];
                right_sum+=right[i];
            }
        }
        return count+min(left_sum-left_min+1,right_sum-right_min+1)+1;
    }
};